package com.arpa.wms.domain.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Email;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotEmpty;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * <p>
 * 店铺
 * </p>
 *
 * @author LEO
 * @since 2021-2-22
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="Shop对象", description="店铺")
@TableName("wms_shop")
public class Shop extends BasicEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "全局code")
    @TableField("code")
    private String code;

    @ApiModelProperty(value = "所属机构")
    @TableField("group_code")
    private String groupCode;

    @ApiModelProperty(value = "店铺编码")
    @TableField("shop_code")
    @NotEmpty(message="店铺编码不能为空", groups = {Save.class, Update.class})
    @Length(max = 100, message = "店铺编号编号长度不能大于100个字符", groups = {Save.class, Update.class})
    private String shopCode;

    @ApiModelProperty(value = "店铺名称")
    @TableField("name")
    @NotEmpty(message="店铺名称不能为空", groups = {Save.class, Update.class})
    @Length(max = 100, message = "店铺名称长度不能大于100个字符", groups = {Save.class, Update.class})
    private String name;

    @ApiModelProperty(value = "ISV店铺编码")
    @TableField("isv_code")
    @Length(max = 100, message = "ISV店铺编码长度不能大于100个字符", groups = {Save.class, Update.class})
    private String isvCode;

    @ApiModelProperty(value = "店铺类型")
    @TableField("shop_type")
    @Length(max = 100, message = "店铺类型长度不能大于100个字符", groups = {Save.class, Update.class})
    private String shopType;

    @ApiModelProperty(value = "销售平台、来源平台编码")
    @TableField("source_platform_code")
    @Length(max = 100, message = "销售平台、来源平台编码长度不能大于100个字符", groups = {Save.class, Update.class})
    private String sourcePlatformCode;

    @ApiModelProperty(value = "平台店铺编码、来源平台编码")
    @TableField(value = "platform_shop_code")
    @Length(max = 100, message = "平台店铺编码、来源平台编码长度不能大于100个字符", groups = {Save.class, Update.class})
    private String platformShopCode;

    @ApiModelProperty(value = "平台店铺名称")
    @TableField(value = "platform_shop_name")
    private String platformShopName;

    @ApiModelProperty(value = "事业部编码、货主编码")
    @TableField("shipment_code")
    @Length(max = 100, message = "事业部编码、来源平台编码长度不能大于100个字符", groups = {Save.class, Update.class})
    private String shipmentCode;

    @ApiModelProperty(value = "事业部名称、货主名称")
    @TableField("shipment_name")
    @Length(max = 100, message = "事业部名称、来源平台编码长度不能大于100个字符", groups = {Save.class, Update.class})
    private String shipmentName;

    @ApiModelProperty(value = "仓库编码")
    @TableField("warehouse_code")
    private String warehouseCode;

    @ApiModelProperty(value = "商家编码")
    @TableField("merchants_code")
    @Length(max = 100, message = "商家编码长度不能大于100个字符", groups = {Save.class, Update.class})
    private String merchantsCode;

    @ApiModelProperty(value = "商家名称")
    @TableField("merchants_name")
    @Length(max = 100, message = "商家名称长度不能大于100个字符", groups = {Save.class, Update.class})
    private String merchantsName;

    @ApiModelProperty(value = "联系人")
    @TableField("contacts")
    @Length(max = 100, message = "联系人长度不能大于100个字符", groups = {Save.class, Update.class})
    private String contacts;

    @ApiModelProperty(value = "手机号码")
    @TableField("phone")
    @Length(max = 50, message = "手机号码长度不能大于50个字符", groups = {Save.class, Update.class})
    private String phone;

    @ApiModelProperty(value = "邮箱")
    @Email(message = "比如输入正确的邮箱")
    @TableField("email")
    private String email;

    @ApiModelProperty(value = "传真")
    @TableField("fax")
    @Length(max = 100, message = "商家名称长度不能大于100个字符", groups = {Save.class, Update.class})
    private String fax;

    @ApiModelProperty(value = "省份")
    @TableField("province")
    private String province;

    @ApiModelProperty(value = "城市")
    @TableField("city")
    private String city;

    @ApiModelProperty(value = "县/区")
    @TableField("county")
    private String county;

    @ApiModelProperty(value = "地址")
    @TableField("address")
    @Length(max = 200, message = "商家名称长度不能大于200个字符", groups = {Save.class, Update.class})
    private String address;

    @ApiModelProperty(value = "备注")
    @TableField("remark")
    @Length(max = 200, message = "备注不能大于200个字符", groups = {Save.class, Update.class})
    private String remark;

    @ApiModelProperty(value = "审批人编码")
    @TableField("approved_by")
    private String approvedBy;

    @ApiModelProperty(value = "审批人姓名")
    @TableField("approved_name")
    @Length(max = 50, message = "姓名长度不能大于50个字符", groups = {Save.class, Update.class})
    private String approvedName;

    @ApiModelProperty(value = "审批时间")
    @TableField("gmt_approved")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime gmtApproved;

    @ApiModelProperty(value = "状态 ，0-未审核，1-审核通过，2-审核未通过")
    @TableField("status")
    @Max(value = 2,message = "审核有误")
    private String status;


    @TableField("access_token")
    private String accessToken;
    @TableField("expires_in")
    private Integer expiresIn;
    @TableField("refresh_token")
    private String refreshToken;

    @TableField("user_id")
    private String userId;

    @ApiModelProperty(value = "店铺访问地址")
    @TableField("access_address")
    private String accessAddress;

    @ApiModelProperty(value = "key:调用各个平台的key")
    @TableField("app_key")
    private String appKey;

    @ApiModelProperty(value = "secret:调用各个平台的secret")
    @TableField("app_secret")
    private String appSecret;

    @TableField("gmt_token_exp")
    private Date gmtTokenExp;



    public interface Save {

    }

    public interface Update {

    }

}
